//
//  PayMedthViewTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/16.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PayMedthViewTableViewCell.h"

@implementation PayMedthViewTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.img];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.selectImg];
}

-(UIImageView *)img
{
    if (_img == nil) {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 20, 20)];
        _img.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _img;
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(47, 15, 150, 20)];
        _titleLabel.font = font(16);
        _titleLabel.textColor = SFM51;
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

-(UIImageView *)selectImg
{
    if (_selectImg == nil) {
        _selectImg = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - 35, 15, 20, 20)];
        _selectImg.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _selectImg;
}

-(void)sendPayMedthodModel:(PayMedthodModel *)model
{
    self.titleLabel.text = model.title;
    self.img.image = model.image;
    if (model.isSelect) {
        self.selectImg.image = [UIImage imageNamed:@"selectImg"];
    }else
    {
        self.selectImg.image = [UIImage imageNamed:@"noSelectImg"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
